<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>获取关系的DOM元素</title>
	</head>
	<body>
		<div class="d1">
			helloworld1
			<h3>child1</h3>
			<h3>child2</h3>
			<h3>child3</h3>
		</div>
		<div class="d2">helloworld2</div>
		<div class="d3">helloworld3</div>
		<script type="text/javascript">
		var d1 = document.querySelector('.d1');
		console.log([d1]);

		var body = d1.parentNode;
		var body1 = d1.parentElement;
		console.log(body);	
		console.log(body1);

		var first = d1.firstElementChild;
		console.log(first);
		var last = d1.lastElementChild;
		console.log(last);

		var bro = d1.nextElementSibling;
		console.log(bro);
		var bro1 = d1.previousSibling		;
		console.log(bro1);

		
		
		
		
		
		
		</script>
	</body>
</html>